<template>
  <div class="article-item">
    <!-- :to="'/article/'+article.art_id" -->
    <!-- <van-cell :to="{
        name:'article',
        params:{
            articleId:article.art_id
        }
    }">  我的这个方案就会报错-->
        <van-cell :to="'/article/'+article.art_id">
        <template #title>

            <div class="title van-multi-ellipsis--l2" >{{ article.title }}</div>
            <div class="label">
                <div v-if="article.cover.type === 3" class="cover_wrap">
                    <div class="cover-item" v-for="(item, i) in article.cover.images" :key="i">
                        <van-image
                            class="cover-item-img"
                            :src="item"
                            fit="cover"
                        />
                    </div>
                    
                </div>
                <div class="label-info-wrap">
                    <span>{{ article.aut_name }}</span>
                    <span>{{ article.comm_count }}评论</span>
                    <span>{{ article.pubdate }}</span>
                </div>
            </div>

        </template>
        <template #right-icon>
            <!-- <div class="right-icon"> -->
                <van-image
                    class="right-cover"
                    v-if="article.cover.type === 1"
                    :src="article.cover.images[0]"
                    fit="cover"
                />
            <!-- </div> -->
        </template>
    </van-cell>
  </div>
</template>

<script>
export default {
    props: {
        article: {
            type: Object,
            required: true
        }
    }
}
</script>

<style lang="less" scoped>
.article-item {
    .title {
        font-size: 16px;
        color: #3a3a3a;
    }
    .van-cell__value {
        flex: unset;
        width: 116px;
        height: 73px;
        padding-left: 25px;
    }
    .right-cover {
        width: 116px;
        height: 73px;
    }
    .label-info-wrap span{
        font-size: 12px;
        color: #b4b4b4;
        margin-right: 10px;
    }
    .cover_wrap {
        display: flex;
        padding: 15px 0;
        .cover-item {
            flex: 1;
            height: 73px;
            &:not(:last-child) {
                padding-right: 2px;
            }
            .cover-item-img {
                width: 100%;
                height: 73px;
            }
        }
    }
}
</style>